<?php
/*
	[Bidcms.com!] (C)2009-2011 Bidcms.com.
	This is NOT a freeware, use is subject to license terms
	$author limengqi
	$Id: showcase.class.php 2010-08-24 10:42 $
*/
if(!defined('IN_BIDCMS')) {
	exit('Access Denied');
}
header("content-type:text/html;charset=utf-8");
class callback_controller extends controller
{
	function __construct(){
		
	}
	
	function index_action(){
		echo '{"status":0,"msg":"\u60a8\u6ca1\u6709\u6b64\u9879\u6743\u9650"}';
	}
	
	function notify_action(){
      global $input,$get,$post;
      $type = $get['type'];
	  if(!empty($input)){
	  	$res = $input;
	  } elseif(!empty($post)){
	  	$res = $post;
	  } else {
	  	unset($get['con']);
	  	unset($get['act']);
	  	unset($get['type']);
	  	$res = $get;
	  }
	  file_put_contents(ROOT_PATH.'data/log/'.$type.'.txt', json_encode($res),FILE_APPEND | LOCK_EX);
	  $r = $this->bidcms_model('order_base')->callback($type,$res);
	  if(is_array($r)){
	  	die($r['errinfo']);
	  }
	  echo 'failed';
	}
}
